package com.android.fragmentdemo.coroutineexceptionhandler
import android.util.Log
import kotlinx.coroutines.CoroutineExceptionHandler
import kotlin.coroutines.CoroutineContext

class GlobalCoroutineExceptionHandler : CoroutineExceptionHandler {

    override val key: CoroutineContext.Key<*>
        get() = CoroutineExceptionHandler

    override fun handleException(context: CoroutineContext, exception: Throwable) {
        Log.d(TAG, "GlobalCoroutineExceptionHandler---Exception:${exception.javaClass.simpleName}")
    }

    companion object {
        const val TAG = "GlobalCoroutineExceptionHandler"
    }
}